<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label="内部订单号" prop="internalOrderNumber">
        <el-input v-model="queryParams.internalOrderNumber" placeholder="请输入内部订单号" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="标记多标签" prop="multiLabel">
        <el-input v-model="queryParams.multiLabel" placeholder="请输入标记多标签" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="售后单号" prop="returnOrderId">
        <el-input v-model="queryParams.returnOrderId" placeholder="请输入售后单号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <el-button :icon="!isOpen ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" size="mini"
          @click="shouqi">展开/收起</el-button>
      </el-form-item>
      <div v-if="isOpen">
        <el-form-item label="发货仓" prop="shippingWarehouse">
          <el-input v-model="queryParams.shippingWarehouse" placeholder="请输入发货仓" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="虚拟仓" prop="virtualWarehouse">
          <el-input v-model="queryParams.virtualWarehouse" placeholder="请输入虚拟仓" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="店铺" prop="shopName">
          <el-input v-model="queryParams.shopName" placeholder="请输入店铺" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="买家ID" prop="buyerId">
          <el-input v-model="queryParams.buyerId" placeholder="请输入买家ID" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="卖家备注" prop="buyerMark">
          <el-input v-model="queryParams.buyerMark" placeholder="请输入卖家备注" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="订单日期" prop="orderDate">
          <el-date-picker clearable v-model="queryParams.orderDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择订单日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="发货日期" prop="shippingDate">
          <el-date-picker clearable v-model="queryParams.shippingDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择发货日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="付款日期" prop="payDate">
          <el-date-picker clearable v-model="queryParams.payDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择付款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="确认收货日期" prop="confirmReceiptDate">
          <el-date-picker clearable v-model="queryParams.confirmReceiptDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择确认收货日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="供销支付时间" prop="supplyPaymentDate">
          <el-date-picker clearable v-model="queryParams.supplyPaymentDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择供销支付时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="省" prop="province">
          <el-input v-model="queryParams.province" placeholder="请输入省" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="市" prop="city">
          <el-input v-model="queryParams.city" placeholder="请输入市" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="区县" prop="county">
          <el-input v-model="queryParams.county" placeholder="请输入区县" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="快递公司" prop="deliveryCompany">
          <el-input v-model="queryParams.deliveryCompany" placeholder="请输入快递公司" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="售后登记日期" prop="aftersalesRegistrationDate">
          <el-date-picker clearable v-model="queryParams.aftersalesRegistrationDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择售后登记日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="售后确认日期" prop="aftersalesConfirmationDate">
          <el-date-picker clearable v-model="queryParams.aftersalesConfirmationDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择售后确认日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="售后分类" prop="aftersalesClassification">
          <el-input v-model="queryParams.aftersalesClassification" placeholder="请输入售后分类" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="商品编码" prop="productCode">
          <el-input v-model="queryParams.productCode" placeholder="请输入商品编码" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="款式编码" prop="productNo">
          <el-input v-model="queryParams.productNo" placeholder="请输入款式编码" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="原始线上订单号" prop="onlineOrderNumber">
          <el-input v-model="queryParams.onlineOrderNumber" placeholder="请输入原始线上订单号" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input v-model="queryParams.brand" placeholder="请输入品牌" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="基本售价" prop="basicSellingPrice">
          <el-input v-model="queryParams.basicSellingPrice" placeholder="请输入基本售价" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="成本价" prop="costPrice">
          <el-input v-model="queryParams.costPrice" placeholder="请输入成本价" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="销售数量" prop="salesNum">
          <el-input v-model="queryParams.salesNum" placeholder="请输入销售数量" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="实发数量" prop="actualShipmentNum">
          <el-input v-model="queryParams.actualShipmentNum" placeholder="请输入实发数量" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="实发金额" prop="actualShipmentAmount">
          <el-input v-model="queryParams.actualShipmentAmount" placeholder="请输入实发金额" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="销售金额" prop="salesAmount">
          <el-input v-model="queryParams.salesAmount" placeholder="请输入销售金额" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="销售成本" prop="salesCost">
          <el-input v-model="queryParams.salesCost" placeholder="请输入销售成本" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="实发成本" prop="actualShipmentCost">
          <el-input v-model="queryParams.actualShipmentCost" placeholder="请输入实发成本" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="销售毛利" prop="salesGrossProfit">
          <el-input v-model="queryParams.salesGrossProfit" placeholder="请输入销售毛利" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="销售毛利率" prop="grossProfitMargin">
          <el-input v-model="queryParams.grossProfitMargin" placeholder="请输入销售毛利率" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="已付金额" prop="paidAmount">
          <el-input v-model="queryParams.paidAmount" placeholder="请输入已付金额" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="应付金额" prop="dueAmount">
          <el-input v-model="queryParams.dueAmount" placeholder="请输入应付金额" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="退货数量" prop="returnNum">
          <el-input v-model="queryParams.returnNum" placeholder="请输入退货数量" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="实退数量" prop="actualReturnNum">
          <el-input v-model="queryParams.actualReturnNum" placeholder="请输入实退数量" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="退货金额" prop="returnAmount">
          <el-input v-model="queryParams.returnAmount" placeholder="请输入退货金额" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="实退金额" prop="actualReturnAmount">
          <el-input v-model="queryParams.actualReturnAmount" placeholder="请输入实退金额" clearable
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="商店站点" prop="storeSite">
          <el-input v-model="queryParams.storeSite" placeholder="请输入商店站点" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="店铺编号" prop="storeNo">
          <el-input v-model="queryParams.storeNo" placeholder="请输入店铺编号" clearable @keyup.enter.native="handleQuery" />
        </el-form-item>
      </div>
      <!-- <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item> -->
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5" style="display:none">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['product:BiOrigOrderProduct:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5" style="display:none">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['product:BiOrigOrderProduct:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5" style="display:none">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['product:BiOrigOrderProduct:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['product:BiOrigOrderProduct:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <div ref="tableDom">
      <el-table v-loading="loading" :maxHeight="BiOrigOrderProductList.length ? tableHeight : 'auto'"
        :data="BiOrigOrderProductList" @selection-change="handleSelectionChange">
        <!-- <el-table-column width="140" type="selection" width="55" align="center" /> -->
        <el-table-column width="140" label="ID" align="center" prop="id" />
        <el-table-column width="140" label="内部订单号" align="center" prop="internalOrderNumber" />
        <el-table-column width="140" label="标记多标签" align="center" prop="multiLabel" />
        <el-table-column width="140" label="售后单号" align="center" prop="returnOrderId" />
        <el-table-column width="140" label="订单类型" align="center" prop="orderType" />
        <el-table-column width="140" label="订单状态" align="center" prop="orderStatus" />
        <el-table-column width="140" label="发货仓" align="center" prop="shippingWarehouse" />
        <el-table-column width="140" label="虚拟仓" align="center" prop="virtualWarehouse" />
        <el-table-column width="140" label="店铺" align="center" prop="shopName" />
        <el-table-column width="140" label="买家ID" align="center" prop="buyerId" />
        <el-table-column width="140" label="卖家备注" align="center" prop="buyerMark" />
        <el-table-column width="140" label="订单日期" align="center" prop="orderDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="发货日期" align="center" prop="shippingDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.shippingDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="付款日期" align="center" prop="payDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.payDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="确认收货日期" align="center" prop="confirmReceiptDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.confirmReceiptDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="供销支付时间" align="center" prop="supplyPaymentDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.supplyPaymentDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="省" align="center" prop="province" />
        <el-table-column width="140" label="市" align="center" prop="city" />
        <el-table-column width="140" label="区县" align="center" prop="county" />
        <el-table-column width="140" label="快递公司" align="center" prop="deliveryCompany" />
        <el-table-column width="140" label="售后登记日期" align="center" prop="aftersalesRegistrationDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.aftersalesRegistrationDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="售后确认日期" align="center" prop="aftersalesConfirmationDate">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.aftersalesConfirmationDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column width="140" label="售后分类" align="center" prop="aftersalesClassification" />
        <el-table-column width="140" label="商品编码" align="center" prop="productCode" />
        <el-table-column width="140" label="款式编码" align="center" prop="productNo" />
        <el-table-column width="140" label="原始线上订单号" align="center" prop="onlineOrderNumber" />
        <el-table-column width="140" label="品牌" align="center" prop="brand" />
        <el-table-column width="140" label="基本售价" align="center" prop="basicSellingPrice" />
        <el-table-column width="140" label="成本价" align="center" prop="costPrice" />
        <el-table-column width="140" label="销售数量" align="center" prop="salesNum" />
        <el-table-column width="140" label="实发数量" align="center" prop="actualShipmentNum" />
        <el-table-column width="140" label="实发金额" align="center" prop="actualShipmentAmount" />
        <el-table-column width="140" label="销售金额" align="center" prop="salesAmount" />
        <el-table-column width="140" label="销售成本" align="center" prop="salesCost" />
        <el-table-column width="140" label="实发成本" align="center" prop="actualShipmentCost" />
        <el-table-column width="140" label="销售毛利" align="center" prop="salesGrossProfit" />
        <el-table-column width="140" label="销售毛利率" align="center" prop="grossProfitMargin" />
        <el-table-column width="140" label="已付金额" align="center" prop="paidAmount" />
        <el-table-column width="140" label="应付金额" align="center" prop="dueAmount" />
        <el-table-column width="140" label="退货数量" align="center" prop="returnNum" />
        <el-table-column width="140" label="实退数量" align="center" prop="actualReturnNum" />
        <el-table-column width="140" label="退货金额" align="center" prop="returnAmount" />
        <el-table-column width="140" label="实退金额" align="center" prop="actualReturnAmount" />
        <el-table-column width="140" label="商店站点" align="center" prop="storeSite" />
        <el-table-column width="140" label="店铺编号" align="center" prop="storeNo" />
        <!-- <el-table-column width="140" label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['product:BiOrigOrderProduct:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['product:BiOrigOrderProduct:remove']">删除</el-button>
        </template>
      </el-table-column> -->
      </el-table>
    </div>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改BiOrigOrderProduct对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="内部订单号" prop="internalOrderNumber">
          <el-input v-model="form.internalOrderNumber" placeholder="请输入内部订单号" />
        </el-form-item>
        <el-form-item label="标记多标签" prop="multiLabel">
          <el-input v-model="form.multiLabel" placeholder="请输入标记多标签" />
        </el-form-item>
        <el-form-item label="售后单号" prop="returnOrderId">
          <el-input v-model="form.returnOrderId" placeholder="请输入售后单号" />
        </el-form-item>
        <el-form-item label="发货仓" prop="shippingWarehouse">
          <el-input v-model="form.shippingWarehouse" placeholder="请输入发货仓" />
        </el-form-item>
        <el-form-item label="虚拟仓" prop="virtualWarehouse">
          <el-input v-model="form.virtualWarehouse" placeholder="请输入虚拟仓" />
        </el-form-item>
        <el-form-item label="店铺" prop="shopName">
          <el-input v-model="form.shopName" placeholder="请输入店铺" />
        </el-form-item>
        <el-form-item label="买家ID" prop="buyerId">
          <el-input v-model="form.buyerId" placeholder="请输入买家ID" />
        </el-form-item>
        <el-form-item label="卖家备注" prop="buyerMark">
          <el-input v-model="form.buyerMark" placeholder="请输入卖家备注" />
        </el-form-item>
        <el-form-item label="订单日期" prop="orderDate">
          <el-date-picker clearable v-model="form.orderDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择订单日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="发货日期" prop="shippingDate">
          <el-date-picker clearable v-model="form.shippingDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择发货日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="付款日期" prop="payDate">
          <el-date-picker clearable v-model="form.payDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择付款日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="确认收货日期" prop="confirmReceiptDate">
          <el-date-picker clearable v-model="form.confirmReceiptDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择确认收货日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="供销支付时间" prop="supplyPaymentDate">
          <el-date-picker clearable v-model="form.supplyPaymentDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择供销支付时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="省" prop="province">
          <el-input v-model="form.province" placeholder="请输入省" />
        </el-form-item>
        <el-form-item label="市" prop="city">
          <el-input v-model="form.city" placeholder="请输入市" />
        </el-form-item>
        <el-form-item label="区县" prop="county">
          <el-input v-model="form.county" placeholder="请输入区县" />
        </el-form-item>
        <el-form-item label="快递公司" prop="deliveryCompany">
          <el-input v-model="form.deliveryCompany" placeholder="请输入快递公司" />
        </el-form-item>
        <el-form-item label="售后登记日期" prop="aftersalesRegistrationDate">
          <el-date-picker clearable v-model="form.aftersalesRegistrationDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择售后登记日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="售后确认日期" prop="aftersalesConfirmationDate">
          <el-date-picker clearable v-model="form.aftersalesConfirmationDate" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择售后确认日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="售后分类" prop="aftersalesClassification">
          <el-input v-model="form.aftersalesClassification" placeholder="请输入售后分类" />
        </el-form-item>
        <el-form-item label="商品编码" prop="productCode">
          <el-input v-model="form.productCode" placeholder="请输入商品编码" />
        </el-form-item>
        <el-form-item label="款式编码" prop="productNo">
          <el-input v-model="form.productNo" placeholder="请输入款式编码" />
        </el-form-item>
        <el-form-item label="原始线上订单号" prop="onlineOrderNumber">
          <el-input v-model="form.onlineOrderNumber" placeholder="请输入原始线上订单号" />
        </el-form-item>
        <el-form-item label="品牌" prop="brand">
          <el-input v-model="form.brand" placeholder="请输入品牌" />
        </el-form-item>
        <el-form-item label="基本售价" prop="basicSellingPrice">
          <el-input v-model="form.basicSellingPrice" placeholder="请输入基本售价" />
        </el-form-item>
        <el-form-item label="成本价" prop="costPrice">
          <el-input v-model="form.costPrice" placeholder="请输入成本价" />
        </el-form-item>
        <el-form-item label="销售数量" prop="salesNum">
          <el-input v-model="form.salesNum" placeholder="请输入销售数量" />
        </el-form-item>
        <el-form-item label="实发数量" prop="actualShipmentNum">
          <el-input v-model="form.actualShipmentNum" placeholder="请输入实发数量" />
        </el-form-item>
        <el-form-item label="实发金额" prop="actualShipmentAmount">
          <el-input v-model="form.actualShipmentAmount" placeholder="请输入实发金额" />
        </el-form-item>
        <el-form-item label="销售金额" prop="salesAmount">
          <el-input v-model="form.salesAmount" placeholder="请输入销售金额" />
        </el-form-item>
        <el-form-item label="销售成本" prop="salesCost">
          <el-input v-model="form.salesCost" placeholder="请输入销售成本" />
        </el-form-item>
        <el-form-item label="实发成本" prop="actualShipmentCost">
          <el-input v-model="form.actualShipmentCost" placeholder="请输入实发成本" />
        </el-form-item>
        <el-form-item label="销售毛利" prop="salesGrossProfit">
          <el-input v-model="form.salesGrossProfit" placeholder="请输入销售毛利" />
        </el-form-item>
        <el-form-item label="销售毛利率" prop="grossProfitMargin">
          <el-input v-model="form.grossProfitMargin" placeholder="请输入销售毛利率" />
        </el-form-item>
        <el-form-item label="已付金额" prop="paidAmount">
          <el-input v-model="form.paidAmount" placeholder="请输入已付金额" />
        </el-form-item>
        <el-form-item label="应付金额" prop="dueAmount">
          <el-input v-model="form.dueAmount" placeholder="请输入应付金额" />
        </el-form-item>
        <el-form-item label="退货数量" prop="returnNum">
          <el-input v-model="form.returnNum" placeholder="请输入退货数量" />
        </el-form-item>
        <el-form-item label="实退数量" prop="actualReturnNum">
          <el-input v-model="form.actualReturnNum" placeholder="请输入实退数量" />
        </el-form-item>
        <el-form-item label="退货金额" prop="returnAmount">
          <el-input v-model="form.returnAmount" placeholder="请输入退货金额" />
        </el-form-item>
        <el-form-item label="实退金额" prop="actualReturnAmount">
          <el-input v-model="form.actualReturnAmount" placeholder="请输入实退金额" />
        </el-form-item>
        <el-form-item label="商店站点" prop="storeSite">
          <el-input v-model="form.storeSite" placeholder="请输入商店站点" />
        </el-form-item>
        <el-form-item label="店铺编号" prop="storeNo">
          <el-input v-model="form.storeNo" placeholder="请输入店铺编号" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listBiOrigOrderProduct, getBiOrigOrderProduct, delBiOrigOrderProduct, addBiOrigOrderProduct, updateBiOrigOrderProduct } from "@/api/chart/BiOrigOrderProduct";

export default {
  name: "BiOrigOrderProduct",
  data() {
    return {
      dayActive: 2,
      timeArr: [{ value: '2', label: '昨天' }, { value: '7', label: '最近7天' }, { value: '30', label: '最近30天' }, { value: '365', label: '最近一年' }, { value: '1', label: '日' }],
      timeGap: { startTime: "", endTime: "" },
      isOpen: false,
      //纵向滚动条
      tableHeight: '',
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // BiOrigOrderProduct表格数据
      BiOrigOrderProductList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        internalOrderNumber: null,
        multiLabel: null,
        returnOrderId: null,
        orderType: null,
        orderStatus: null,
        shippingWarehouse: null,
        virtualWarehouse: null,
        shopName: null,
        buyerId: null,
        buyerMark: null,
        orderDate: null,
        shippingDate: null,
        payDate: null,
        confirmReceiptDate: null,
        supplyPaymentDate: null,
        province: null,
        city: null,
        county: null,
        deliveryCompany: null,
        aftersalesRegistrationDate: null,
        aftersalesConfirmationDate: null,
        aftersalesClassification: null,
        productCode: null,
        productNo: null,
        onlineOrderNumber: null,
        brand: null,
        basicSellingPrice: null,
        costPrice: null,
        salesNum: null,
        actualShipmentNum: null,
        actualShipmentAmount: null,
        salesAmount: null,
        salesCost: null,
        actualShipmentCost: null,
        salesGrossProfit: null,
        grossProfitMargin: null,
        paidAmount: null,
        dueAmount: null,
        returnNum: null,
        actualReturnNum: null,
        returnAmount: null,
        actualReturnAmount: null,
        storeSite: null,
        storeNo: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  mounted() {
    var _this = this
    this.resizeTable()
    window.onresize = function () {
      _this.resizeTable()
    }
  },
  //记得清空  如果在keepalive中 则使用activated  deactivated
  destroyed() {
    window.onresize = null
  },
  methods: {
    /** 刷新缓存按钮操作 Warning*/
    handleRefreshCache() {
      this.$modal.msgWarning("数据正在同步，请稍候")
      const obj = { updateDate: this.timeGap.startTime }
      updateByCreateUpdate(obj).then(() => {
        this.$modal.msgSuccess("同步数据成功");
        this.getList()
        // this.$store.dispatch('dict/cleanDict');
      });
    },
    //时间控件
    changDay(val) {
      this.dayActive = val;
      this.timeGap.startTime = val[0];
      this.timeGap.endTime = val[1];
    },
    getDateArr(value) {
      this.timeGap.startTime = value[0];
      this.timeGap.endTime = value[1];
      console.log(JSON.stringify(this.timeGap));
      this.queryParams.payDayStart = this.timeGap.startTime
      this.queryParams.payDayEnd = this.timeGap.endTime

      this.getList()

      this.dayActive = 1
    },
    //搜索栏展示与收起
    shouqi() {
      // console.log(1);
      this.isOpen = !this.isOpen;
    },
    // table自动高度
    returnTableHeight(ref, bottomOffset) {
      let height = null
      height = window.innerHeight - ref.getBoundingClientRect().top - bottomOffset
      return height
    },


    resizeTable() {
      this.$nextTick(() => {
        this.tableHeight = this.returnTableHeight(this.$refs.tableDom, 100)
      }, 0)
    },
    /** 查询BiOrigOrderProduct列表 */
    getList() {
      this.loading = true;
      listBiOrigOrderProduct(this.queryParams).then(response => {
        this.BiOrigOrderProductList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        internalOrderNumber: null,
        multiLabel: null,
        returnOrderId: null,
        orderType: null,
        orderStatus: null,
        shippingWarehouse: null,
        virtualWarehouse: null,
        shopName: null,
        buyerId: null,
        buyerMark: null,
        orderDate: null,
        shippingDate: null,
        payDate: null,
        confirmReceiptDate: null,
        supplyPaymentDate: null,
        province: null,
        city: null,
        county: null,
        deliveryCompany: null,
        aftersalesRegistrationDate: null,
        aftersalesConfirmationDate: null,
        aftersalesClassification: null,
        productCode: null,
        productNo: null,
        onlineOrderNumber: null,
        brand: null,
        basicSellingPrice: null,
        costPrice: null,
        salesNum: null,
        actualShipmentNum: null,
        actualShipmentAmount: null,
        salesAmount: null,
        salesCost: null,
        actualShipmentCost: null,
        salesGrossProfit: null,
        grossProfitMargin: null,
        paidAmount: null,
        dueAmount: null,
        returnNum: null,
        actualReturnNum: null,
        returnAmount: null,
        actualReturnAmount: null,
        storeSite: null,
        storeNo: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加BiOrigOrderProduct";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getBiOrigOrderProduct(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改BiOrigOrderProduct";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateBiOrigOrderProduct(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBiOrigOrderProduct(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除BiOrigOrderProduct编号为"' + ids + '"的数据项？').then(function () {
        return delBiOrigOrderProduct(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('product/BiOrigOrderProduct/export', {
        ...this.queryParams
      }, `BiOrigOrderProduct_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
